package com.njworkorder.HTSingleLogin;

import java.util.List;

import cn.microvideo.qsc.client.api.QsApi;
import cn.microvideo.qsc.client.entity.User;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 综管用户Service业务层处理
 *
 * @author ht
 * @date 2024-08-04
 */
@Service("qsUserServiceImpl")
public class QsUserServiceImpl implements IQsUserService
{
    private final QsUserMapper qsUserMapper;

    public QsUserServiceImpl(QsUserMapper qsUserMapper) {
        this.qsUserMapper = qsUserMapper;
    }

//    @Autowired
//    QsConfig qsConfig;

    /**
     * 查询综管用户
     *
     * @param uuid 综管用户主键
     * @return 综管用户
     */
    @Override
    public QsUser selectQsUserByUuid(String uuid)
    {
        return qsUserMapper.selectQsUserByUuid(uuid);
    }

    /**
     * 查询综管用户列表
     *
     * @param qsUser 综管用户
     * @return 综管用户
     */
    @Override
    public List<QsUser> selectQsUserList(QsUser qsUser)
    {
        return qsUserMapper.selectQsUserList(qsUser);
    }

    /**
     * 新增综管用户
     *
     * @param qsUser 综管用户
     * @return 结果
     */
    @Override
    public int insertQsUser(QsUser qsUser)
    {
        qsUser.setCreateTime(DateUtils.getNowDate());
        return qsUserMapper.insertQsUser(qsUser);
    }

    /**
     * 修改综管用户
     *
     * @param qsUser 综管用户
     * @return 结果
     */
    @Override
    public int updateQsUser(QsUser qsUser)
    {
        qsUser.setUpdateTime(DateUtils.getNowDate());
        return qsUserMapper.updateQsUser(qsUser);
    }

    /**
     * 批量删除综管用户
     *
     * @param uuids 需要删除的综管用户主键
     * @return 结果
     */
    @Override
    public int deleteQsUserByUuids(String[] uuids)
    {
        return qsUserMapper.deleteQsUserByUuids(uuids);
    }

    /**
     * 删除综管用户信息
     *
     * @param uuid 综管用户主键
     * @return 结果
     */
    @Override
    public int deleteQsUserByUuid(String uuid)
    {
        return qsUserMapper.deleteQsUserByUuid(uuid);
    }

    @Override
    public User selectZgUserByUserName(String uid) {
        User user = QsApi.getApi().getPersonByPid(uid);
//        AsyncManager.me().execute(AsyncFactory.recordZGInfo(user));
        return user;
    }

    @Override
    public QsUser selectQsUserByUid(String uid) {
        return qsUserMapper.selectQsUserByUid(uid);
    }

    @Override
    public List<QsUserVo> selectListByCompanyOrDept(String parentId) {

        List<QsUserVo> qsUserVos=  qsUserMapper.selectListByCompanyOrDept(parentId);
        return qsUserVos;
    }

    @Override
    public List<QsUserVo> selectQsUserVoList(QsUser qsUser) {
        List<QsUserVo> qsUserVos=  qsUserMapper.selectVoListByParam(qsUser);
        return qsUserVos;
    }
}
